home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 3.7 KB | 94 lines | [TEXT/GEOL] |
- Item 8920476 28-July-90 05:34PDT
-
- From: POWERUP.ENG Power Up Software,PRT
-
- To: ATKINSON1 Atkinson, Bill,VCA
- MACAPP.TECH$ MacApp Technical
-
- Sub: RE>QD region data structu
-
- Attn: Bill Atkinson
- Attn: MacApp.Tech$
- SentBy: James Plamondon
- Date 7/27/90
- Subject RE>QD region data structure
- From James Plamondon
- To Macintosh Developer Tech Supt
- CC Bill Atkinson, MacApp.Tech$
-
- Subject: RE>QD region data structure
- Dear Mr. Collyer,
-
- I am truly saddened by the gist of your response (item 8760782) to my link
- regarding documentation of the region data structure, in which you said,
- basically, that I was SOL. However, if that's the way it is, then that's the
- way it is.
-
- I do have a suggestion, however: add an EachPointInRegionDo() procedure to
- the Toolbox. Such a procedure would make the region structure even more
- powerful, and its uses more diverse.
-
- I am not the only one who needs such a procedure; here's an example of how
- Apple itself is already suffering for the lack of it.
-
- The region data structure is used by MacApp's TGridView class to help with
- selection. Each cell in the grid corresponds to a point (potentially) in a
- region. To iterate through the cells of the selection, TGridView has a method
- called TGridView.EachInRgn(). This routine is implemented in the only manner
- possible, given the position of Apple vis-a-vis regions: as double loop,
- calling PtInRgn() on each column of each row in the region's bounding box.
-
- If, for example, only two cells were selected, those being (1, 1) and (100,
- 100), then 10,000 calls to PtInRgn() will be made to find these two cells.
- This implementation is incredibly inefficient, making this use of regions
- almost pointless.
-
- On the other hand, by implementing a Toolbox routine which examined the region
- data structure directly, Apple could speed up this and similar uses of regions
- tremendously. The routine would have to be updated whenever the region data
- structure changed, of course, but that is true of all of the Toolbox's current
- region-manipulating routines, as well.
-
- Given these advantages, I suggest the following procedure definition for your
- consideration:
-
- PROCEDURE EachPointInRegionDo(
- theRegion: RgnHandle;
- doToPoint: ProcPtr;
- param: UNIV LONGINT);
-
- in which doToPoint must point to a procedure with the following definition:
-
- PROCEDURE DoToPoint(
- thePoint: Point;
- param: UNIV LONGINT);
-
- The 'param' actual argument could be any 32-bit entity. It would be ignored
- by EachPointInRegionDo() except in that it would be passed along to
- DoToPoint() unchanged. The 'param' argument can thus be used to supply
- context to the DoToPoint() routine, e.g. via a record pointer or an object
- reference.
-
- Alternatively, DoToPoint() could be passed to EachPointInRegionDo() as a
- procedure argument, as follows:
-
- PROCEDURE EachPointInRegionDo(
- theRegion: RgnHandle;
- PROCEDURE DoToPoint(
- thePoint: Point));
-
- I'd actually prefer this, but I expect that the C faction will disagree — and
- I can see their point.
-
- I hope that you will treat this suggestion with the seriousness that I feel it
- deserves. If you want a second opinion, show this link and
- TGridView.EachInRgn() to Steve Friedrich, and I'll bet you dollars to donuts
- he'll agree with me.
-
- Doing my best to help increase the value of Apple's patents, I remain
-
- Yours,
-
- James Plamondon
-
-